<?php
/*
 * 列表页加载文件
 * @author  Mark
 * @package infomation
 * @file    list.inc.php
 * @time    12-12-13 上午10:51
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.MODULE_NAME.'/common.inc.php';
// 检测类别是否和模块符合
if(!$CAT || $CAT['moduleid'] != $moduleid) {
	$head_title = lang('message->cate_not_exists');
	@header("HTTP/1.1 404 Not Found");
	exit(include template('list-notfound', 'message'));
}
unset($CAT['moduleid']);
extract($CAT);

// 分类, 有子元素的话, 类为当前类, 否则的话是父类
$maincat = get_maincat($child ? $catid : $parentid, $moduleid);

// 初始化条件
$condition = '(status=3 or status=2)';
// 子分类内容筛选
$condition .= ($CAT['child']) ? " AND catid IN (".$CAT['arrchildid'].")" : " AND catid=$catid";

// 分页条目的展示
if($cityid) {
	$condition .=  " AND (city like '%|".$cityid."|%' or city like '%|0|%')";
	$items = $db->count($table, $condition, $CFG['db_expires']);
} else {
	if($page == 1) {
		$items = $db->count($table, $condition, $CFG['db_expires']);
		if($items != $CAT['item']) {
			$CAT['item'] = $items;
			$db->query("UPDATE {$db->getPre()}category SET item=$items WHERE catid=$catid");
		}
	} else {
		$items = $CAT['item'];
	}
}
// 模块的分页数
$tags = array();
$do   = new InformationModule($moduleid);
if($items) {
	$tags = $do->getList($condition,$MOD['order'],($CFG['db_expires'] && $page == 1) ? 'CACHE' : '');
}
$showpage = 1;
$datetype = 5;
$cols = 5;

$seo_file = 'list';
include DT_INC.'/seo.inc.php';

$template = $CAT['template'] ? $CAT['template'] : ($MOD['template_list'] ? $MOD['template_list'] : 'list');
include template($template, MODULE_NAME);

?>